home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIServiceManagerObsolete.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  207 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is XPCOM.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #ifndef nsIServiceManagerObsolete_h___
  39. #define nsIServiceManagerObsolete_h___
  40.  
  41. ////////////////////////////////////////////////////////////////////
  42. //
  43. // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  44. //
  45. // Functions, classes, interfaces and types in this file  are 
  46. // obsolete.  Use at your own risk.  
  47. // Please see nsIServiceManager.idl for the supported interface
  48. // to the service manager.
  49. //
  50. ////////////////////////////////////////////////////////////////////
  51.  
  52. #include "nsIComponentManager.h"
  53. #include "nsID.h"
  54.  
  55. #ifndef nsCOMPtr_h___
  56. #include "nsCOMPtr.h"
  57. #endif
  58.  
  59. class nsIServiceManager;
  60. class nsIShutdownListener;
  61. class nsIDirectoryServiceProvider;
  62.  
  63. class nsServiceManagerObsolete;
  64.  
  65. #define NS_ISERVICEMANAGER_OBSOLETE_IID              \
  66. { /* cf0df3b0-3401-11d2-8163-006008119d7a */         \
  67.     0xcf0df3b0,                                      \
  68.     0x3401,                                          \
  69.     0x11d2,                                          \
  70.     {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
  71. }
  72.  
  73. /**
  74.  * The nsIServiceManagerObsolete manager is obsolete.  Please refer
  75.  * to nsIServiceManager.
  76.  */
  77. class nsIServiceManagerObsolete : public nsISupports {
  78. public:
  79.  
  80.     NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISERVICEMANAGER_OBSOLETE_IID);
  81.  
  82.     /**
  83.      * RegisterService may be called explicitly to register a service
  84.      * with the service manager. If a service is not registered explicitly,
  85.      * the component manager will be used to create an instance according
  86.      * to the class ID specified.
  87.      */
  88.     NS_IMETHOD
  89.     RegisterService(const nsCID& aClass, nsISupports* aService) = 0;
  90.  
  91.     /**
  92.      * Requests a service to be shut down, possibly unloading its DLL.
  93.      *
  94.      * @returns NS_OK - if shutdown was successful and service was unloaded,
  95.      * @returns NS_ERROR_SERVICE_NOT_FOUND - if shutdown failed because
  96.      *          the service was not currently loaded
  97.      * @returns NS_ERROR_SERVICE_IN_USE - if shutdown failed because some
  98.      *          user of the service wouldn't voluntarily release it by using
  99.      *          a shutdown listener.
  100.      */
  101.     NS_IMETHOD
  102.     UnregisterService(const nsCID& aClass) = 0;
  103.  
  104.     NS_IMETHOD
  105.     GetService(const nsCID& aClass, const nsIID& aIID,
  106.                nsISupports* *result,
  107.                nsIShutdownListener* shutdownListener = nsnull) = 0;
  108.  
  109.     /* OBSOLETE: use NS_RELEASE(service) instead. */
  110.     NS_IMETHOD
  111.     ReleaseService(const nsCID& aClass, nsISupports* service,
  112.                    nsIShutdownListener* shutdownListener = nsnull) = 0;
  113.  
  114.     ////////////////////////////////////////////////////////////////////////////
  115.     // let's do it again, this time with ContractIDs...
  116.  
  117.     NS_IMETHOD
  118.     RegisterService(const char* aContractID, nsISupports* aService) = 0;
  119.  
  120.     NS_IMETHOD
  121.     UnregisterService(const char* aContractID) = 0;
  122.  
  123.     NS_IMETHOD
  124.     GetService(const char* aContractID, const nsIID& aIID,
  125.                nsISupports* *result,
  126.                nsIShutdownListener* shutdownListener = nsnull) = 0;
  127.  
  128.     /* OBSOLETE */
  129.     NS_IMETHOD
  130.     ReleaseService(const char* aContractID, nsISupports* service,
  131.                    nsIShutdownListener* shutdownListener = nsnull) = 0;
  132.  
  133. };
  134.  
  135. // Interface to Global Services
  136. class NS_COM nsServiceManager {
  137. public:
  138.  
  139.     static nsresult
  140.     RegisterService(const nsCID& aClass, nsISupports* aService);
  141.  
  142.     static nsresult
  143.     UnregisterService(const nsCID& aClass);
  144.  
  145.     static nsresult
  146.     GetService(const nsCID& aClass, const nsIID& aIID,
  147.                nsISupports* *result,
  148.                nsIShutdownListener* shutdownListener = nsnull);
  149.  
  150.     /* OBSOLETE: use NS_RELEASE(service) instead. */
  151.     static nsresult
  152.     ReleaseService(const nsCID& aClass, nsISupports* service,
  153.                    nsIShutdownListener* shutdownListener = nsnull);
  154.  
  155.     ////////////////////////////////////////////////////////////////////////////
  156.     // let's do it again, this time with ContractIDs...
  157.  
  158.     static nsresult
  159.     RegisterService(const char* aContractID, nsISupports* aService);
  160.  
  161.     static nsresult
  162.     UnregisterService(const char* aContractID);
  163.  
  164.     static nsresult
  165.     GetService(const char* aContractID, const nsIID& aIID,
  166.                nsISupports* *result,
  167.                nsIShutdownListener* shutdownListener = nsnull);
  168.  
  169.     /* OBSOLETE: use NS_RELEASE(service) instead. */
  170.     static nsresult
  171.     ReleaseService(const char* aContractID, nsISupports* service,
  172.                    nsIShutdownListener* shutdownListener = nsnull);
  173.  
  174.  
  175.     ////////////////////////////////////////////////////////////////////////////
  176.     // These methods return really nsIServiceManagerObsolete, but they are 
  177.     // statically cast to nsIServiceManager to preserve backwards compatiblity.
  178.     static nsresult GetGlobalServiceManager(nsIServiceManager* *result);
  179.     static nsresult ShutdownGlobalServiceManager(nsIServiceManager* *result);
  180. };
  181.  
  182.  
  183. #define NS_DECL_NSISERVICEMANAGEROBSOLETE \
  184.     NS_IMETHOD RegisterService(const nsCID& aClass, nsISupports* aService); \
  185.     NS_IMETHOD UnregisterService(const nsCID& aClass);\
  186.     NS_IMETHOD GetService(const nsCID& aClass, const nsIID& aIID, nsISupports* *result, nsIShutdownListener* shutdownListener);\
  187.     NS_IMETHOD ReleaseService(const nsCID& aClass, nsISupports* service, nsIShutdownListener* shutdownListener);\
  188.     NS_IMETHOD RegisterService(const char* aContractID, nsISupports* aService);\
  189.     NS_IMETHOD UnregisterService(const char* aContractID);\
  190.     NS_IMETHOD GetService(const char* aContractID, const nsIID& aIID, nsISupports* *result, nsIShutdownListener* shutdownListener);\
  191.     NS_IMETHOD ReleaseService(const char* aContractID, nsISupports* service, nsIShutdownListener* shutdownListener);
  192.  
  193. ////////////////////////////////////////////////////////////////////////////////
  194.  
  195. #define NS_ISHUTDOWNLISTENER_IID                     \
  196. { /* 56decae0-3406-11d2-8163-006008119d7a */         \
  197.     0x56decae0,                                      \
  198.     0x3406,                                          \
  199.     0x11d2,                                          \
  200.     {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
  201. }
  202.  
  203. ////////////////////////////////////////////////////////////////////////////////
  204.  
  205.  
  206. #endif /* nsIServiceManagerObsolete_h___ */
  207.